abstract class Package {
  // 构造方法
  constructor(public weight: number) {}

  // 抽象方法，不配拥有函数体{}
  abstract calculate(x: number, y: number): number

  // 具体方法
  printPackage() {
    console.log(`包裹的重量为${this.weight}`, `包裹的体积为${this.calculate(1, 2)}`)
  }
}

class PackageA extends Package {
  constructor(public weight: number, public unitPrice: number) {
    super(weight)
  }
  calculate(x: number, y: number): number {
    return this.weight * this.unitPrice
  }
}

const p = new PackageA(10, 5)
p.printPackage()

export {}